﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:local="clr-namespace:ProverbTeleprompter" 
        xmlns:Controls="clr-namespace:ProverbTeleprompter.Controls" 
        xmlns:Helpers="clr-namespace:ProverbTeleprompter.Helpers" mc:Ignorable="d"   
 x:Class="ProverbTeleprompter.MainWindow"
        x:Name="LayoutRoot"
        Title="Proverb Teleprompter" 
        Height="{Controls:SettingBinding MainWindowHeight}"
        Width="{Controls:SettingBinding MainWindowWidth}"
        Top="{Controls:SettingBinding MainWindowTop}"
        Left="{Controls:SettingBinding MainWindowLeft}"
        WindowStyle="None" 
        WindowState="{Binding MainWindowState, Mode=TwoWay}" Foreground="Black" ResizeMode="CanResize"
        d:DesignHeight="900" d:DesignWidth="900" Icon="ProverbTeleprompterLogo.ico"
		
        >
    <Window.Resources>


        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Resources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>


    </Window.Resources>
    <Grid >
        <Grid.ColumnDefinitions>
        	<ColumnDefinition />
        	<ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
		<Border RenderTransformOrigin="0.5,0.5" Background="{Binding BackgroundColor}">
           
            <Border.RenderTransform>
                <TransformGroup>
                    <RotateTransform x:Name="MainRotate" Angle="0" CenterX="0" CenterY="0"/>
                    <ScaleTransform x:Name="MainScale" ScaleX="{Binding MainWindowScaleX}" 
                                    ScaleY="{Binding MainWindowScaleY}" CenterX="0" CenterY="0" />
                </TransformGroup>
            </Border.RenderTransform>

			<Grid x:Name="MainTextGrid" PreviewMouseMove="Grid_PreviewMouseMove" 
				  
				  Margin="{Binding OuterLeftRightMargin}">
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
             
                <Controls:ScrollViewerExt x:Name="MainScroller" Template="{DynamicResource ScrollViewerControlTemplate1}" 
                                          VerticalOffsetExt="{Binding MainScrollerVerticalOffset, Mode=TwoWay}"
                              Focusable="False" ExtentHeightExt="{Binding MainScrollerExtentHeight, Mode=TwoWay}" 
                                          ViewportHeightExt="{Binding MainScrollerViewportHeight, Mode=TwoWay}"
                              VerticalScrollBarVisibility="Visible"
										   Background="{Binding BackgroundColor}"
										  >

                    <RichTextBox  x:Name="MainTextBox" BorderThickness="0" BorderBrush="Transparent" AcceptsTab="True" 
                                  CaretBrush="{Binding MainDocumentCaretBrush}"  Background="{Binding BackgroundColor}"
        				FontSize="{Binding Value, ElementName=FontSizeSlider}"  Focusable="{Binding Editable, Mode=TwoWay}"
        				  Helpers:RichTextboxAssistant.Document="{Binding MainDocument, Mode=TwoWay}"
								  Margin="{Binding TextMargin}"
								  >

                    </RichTextBox>

                </Controls:ScrollViewerExt>

                <Controls:EyelineTriangleControl x:Name="EyelineLeftTriangle" Opacity="0.7"  
                                              PreviewMouseLeftButtonDown="EyelineLeftTriangle_PreviewMouseLeftButtonDown" 
                                              HorizontalAlignment="Left" Height="{Binding EyelineHeight}" 
                                              Margin="{Binding LeftEyelineMargin}" 
                                              VerticalAlignment="Top" Width="{Binding EyelineWidth}"/>
                <Controls:EyelineTriangleControl x:Name="EyelineRightTriangle"  Opacity="0.7"
                                              PreviewMouseLeftButtonDown="EyelineLeftTriangle_PreviewMouseLeftButtonDown" 
                                              HorizontalAlignment="Right" Height="{Binding EyelineHeight}" 
                                              Margin="{Binding RightEyelineMargin}"
                                              VerticalAlignment="Top" Width="{Binding EyelineWidth}" RenderTransformOrigin="0.5,0.5">
                    <Controls:EyelineTriangleControl.RenderTransform>
                        <ScaleTransform ScaleX="-1" />
                    </Controls:EyelineTriangleControl.RenderTransform>
                </Controls:EyelineTriangleControl>           
            </Grid>
        </Border>

    </Grid>
</Window>
